package com.lin.decorator.beverage;
/**
 * 饮料抽象类
 * @author linfenliang
 *
 */
abstract class Beverage {

	String description = "UnKnown Beverage";
	public abstract double cost();
	public String getDescription() {
		return description;
	}
}
/**
 * 浓缩咖啡
 */
class Espresso extends Beverage{
	public Espresso() {
		this.description = "Espresso";
	}
	@Override
	public double cost() {
		return 1.99;
	}
}
/**
 * HouseBlend 超优深焙咖啡
 */
class HouseBlend extends Beverage{
	public HouseBlend() {
		this.description = "HouseBlend";
	}
	@Override
	public double cost() {
		return 2.99;
	}
}
/**
 * DarkRoast
 */
class DarkRoast extends Beverage{
	public DarkRoast() {
		this.description = "DarkRoast";
	}
	@Override
	public double cost() {
		return 3.99;
	}
}


/**
 * 配料抽象类
 * @author linfenliang
 *
 */
abstract class CondimentDecorator extends Beverage{
	public abstract String getDescription();
}
/**
 * 摩卡配料
 * @author linfenliang
 *
 */
class Mocha extends CondimentDecorator{
	Beverage beverage;
	public Mocha(Beverage beverage) {
		this.beverage = beverage;
	}
	@Override
	public String getDescription() {
		return beverage.getDescription() +",Mocha";
	}

	@Override
	public double cost() {
		return 0.2+beverage.cost();
	}
	
}
/**
 * Soy配料
 * @author linfenliang
 *
 */
class Soy extends CondimentDecorator{
	Beverage beverage;
	public Soy(Beverage beverage) {
		this.beverage = beverage;
	}
	@Override
	public String getDescription() {
		return beverage.getDescription() +",Soy";
	}

	@Override
	public double cost() {
		return 0.3+beverage.cost();
	}
	
}
/**
 * Whip配料
 * @author linfenliang
 *
 */
class Whip extends CondimentDecorator{
	Beverage beverage;
	public Whip(Beverage beverage) {
		this.beverage = beverage;
	}
	@Override
	public String getDescription() {
		return beverage.getDescription() +",Whip";
	}

	@Override
	public double cost() {
		return 0.4+beverage.cost();
	}
}